import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/homepage',
        component: () => import('../views/homePage/HomePageView')
      },
      {
        path: '/category',
        component: () => import('../views/category/CategoryListView.vue')
      },
      {
        path: '/recipe',
        component: () => import('../views/recipe/RecipeListView.vue')
      },
      {
        path: '/recipe/search',
        component: () => import('../views/recipe/RecipeSearchView.vue')
      },
      {
        path: '/recipe/details',
        component: () => import('../views/recipe/RecipeDetailsView.vue')
      },
      {
        path: '/note',
        component: () => import('../views/note/NoteListView.vue')
      },
      {
        path: '/create/recipe',
        component: () => import('../views/create/CreateRecipeView.vue')
      },
      {
        path: '/user/info',
        component: () => import('../views/passport/UserManagement.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import( '../views/passport/LoginView.vue')
  },
  {
    path: '/about',
    name: 'about',
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
